from sgmllib import SGMLParser

class URLLister(SGMLParser):
    def reset(self):
        SGMLParser.reset(self)
        self.url = []
        self.img = []

    def start_a(self, attrs):
        href = [v for k, v in attrs if k=='href']
        if href:
            self.url.extend(href)

    def start_img(self, attrs):
        src = [v for k, v in attrs if k=='src']
        if src:
            self.img.extend(src)
